package org.carabiner.infopanel;

import java.awt.Component;
import java.util.List;

import org.jmock.MockObjectTestCase;

public abstract class AbstractTestRule extends MockObjectTestCase
{
  private Rule m_Rule;

  public AbstractTestRule()
  {
    super();
  }

  protected void setUp() throws Exception
  {
    throw new UnsupportedOperationException("Use setUp(Rule) instead");
  }

  public void setUp(Rule rule) throws Exception
  {
    super.setUp();
    m_Rule = rule;
  }

  public AbstractTestRule(String name)
  {
    super(name);
  }

  /**
   * We get this from a method to keep findbugs from reporting a call to equals
   * on different types warning.
   * 
   * @return Rule
   */
  protected Rule createStubRule()
  {
    return new AbstractRule()
    {
      protected List inspectComponent(Component component)
      {
        return null;
      }

      public String getName()
      {
        return "";
      }

      public String getDescription()
      {
        return "";
      }
    };
  }

  public void testProperties()
  {
    assertNotNull(m_Rule.getName());
    assertNotNull(m_Rule.getIcon());
    assertEquals(16, m_Rule.getIcon().getIconWidth());
    assertEquals(16, m_Rule.getIcon().getIconHeight());
  }

  public abstract void testEquals();

  public abstract void testHashCode();
}
